import store from '@/store/index'
import router from '@/router/index'
const Whitelist = ['/login']
router.beforeEach((to, frpm, next) => {
//   console.log(store.state.user.token)
//   console.log(to.path)
  if (store.state.user.token) {
    if (to.path === '/login') {
      next('/')
    } else {
      next()
    }
  } else {
    if (Whitelist.includes(to.path)) {
      next()
    } else {
      next('/login')
    }
  }
})

